<div class="bodywrap">
	<div data-role="page" id="viewquiz" data-theme="e" class="searchPage"> 
    	<div data-role="content" style="margin:0;padding:0">
        	<ul data-role="listview" data-inset="true" data-theme="e" style="margin:0;padding:0">
            	<li id="listitem" style="margin:0;padding:0; border:0">
               		<div class="subhead">Quizzes under <?php echo $chapterdetail->name;?></div>
  					<?php 
						if(isset($quizdetails) && $quizdetails!='')
						{
							foreach ($quizdetails as $quiz)
							{
					?>
	 							<?php 
	 								$userattempt = UserQuizAttempt::getModel("USER-QUIZ-ATTEMPT-BYMAXTOTAL", array('quizid'=>$quiz->id,'userid'=>Yii::app()->user->id));
	 								//echo "<pre>";print_r($userattempt);
	 							?>
  								<div style="background:#F7ECDE;  border-bottom:1px solid #d6cbbc;">
    							<div style="padding:1px 0; width:99%; margin:0 auto; border-top:1px solid #fff; border-bottom:1px solid #ccc;"> 
    								<a style="font-size:1em; color:#331d01"href="<?php echo ApplicationConfig::getURL('', 'site', 'playQuiz',array('quizid'=>$quiz->id))?>">
    									<?php echo $quiz->title?>
    								</a><br />
      								<?php echo "Description: ".$quiz->description;?><br />
      								Total Questions: <?php echo $quiz->no_of_questions;?><br/>
									<span style="color:#f00; font-weight:bold;">Passing Percentage: <?php echo $quiz->passing_percentage."%";?></span>  
      								<div style="clear:both; width:99%; margin:0 auto;  margin:5px 0 5px 0;">
        								<div class="left" style="margin-right:1%; width:50%;">
        									<a data-icon="arrow-r" rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'playQuiz',array('quizid'=>$quiz->id))?>"   data-role="button" class="ui-btn-right" data-theme="e" >
        										Play Quiz
        									</a>
											<?php if (!empty($userattempt)){?>
												<a data-icon="arrow-r" rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'postQuizDetails',array('attemptid'=>$userattempt['id'],'message'=>'1'))?>"  data-role="button" class="ui-btn-right" data-theme="e" ><?php echo "View Quiz Summary";?></a></div>
         									<?php }?>
         									<br  clear="all" />
      									</div>
      									<br  clear="all" />
    								</div>
  								</div>
					<?php 
							}
						}
						else 
						{
							echo "<p style='color:red'><br />No Quizs available under this Chapter</p>";
						}
					?>					
              	</li>
            </ul>
        </div>
	</div>
</div>  